<!DOCTYPE html>
<html>
<head>
    <title>电梯传奇 - 电梯调度编程游戏</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="font-awesome-4.1-1.0/css/font-awesome.min.css" type="text/css" media="all">
    <link href='//fonts.googleapis.com/css?family=Oswald:400,700,300' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="libs/codemirror/codemirror.css">
    <link rel="stylesheet" href="libs/codemirror/themes/solarized.css">
    <link rel="stylesheet" href="style.css" type="text/css" media="all">

    <script type="text/javascript" src="libs/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="libs/lodash.min.js"></script>
    <script type="text/javascript" src="libs/riot.js"></script>

    <script type="text/javascript" src="libs/codemirror/codemirror.js"></script>
    <script type="text/javascript" src="libs/codemirror/addon/edit/closebrackets.js"></script>
    <script type="text/javascript" src="libs/codemirror/mode/javascript/javascript.js"></script>

    <script type="text/javascript" src="libs/unobservable.js"></script>

    <script type="text/javascript" src="base.js"></script>
    <script type="text/javascript" src="movable.js"></script>
    <script type="text/javascript" src="floor.js"></script>
    <script type="text/javascript" src="user.js"></script>
    <script type="text/javascript" src="elevator.js"></script>
    <script type="text/javascript" src="interfaces.js"></script>
    <script type="text/javascript" src="world.js"></script>
    <script type="text/javascript" src="presenters.js"></script>
    <script type="text/javascript" src="challenges.js"></script>
    <script type="text/javascript" src="fitness.js"></script>
    <script type="text/javascript" src="app.js"></script>


    <script type="text/template" id="user-template">
        <i class="movable fa user fa-{u.displayType} {state}"></i>
    </script>

    <script type="text/template" id="floor-template">
        <div class="floor" style="top: {yPosition}px">
            <span class="floornumber">{level}</span>
            <span class="buttonindicator">
                <i class="fa fa-arrow-circle-up up"></i>
                <i class="fa fa-arrow-circle-down down"></i>
            </span>
        </div>
    </script>

    <script type="text/template" id="elevator-template">
        <div class="elevator movable" style="width: {e.width}px">
            <span class="directionindicator directionindicatorup"><i class="fa fa-arrow-circle-up up activated"></i></span>
            <span class="floorindicator"><span></span></span>
            <span class="directionindicator directionindicatordown"><i class="fa fa-arrow-circle-down down activated"></i></span>
            <span class="buttonindicator"></span>
        </div>
    </script>

    <script type="text/template" id="elevatorbutton-template">
        <span class="buttonpress">{floorNum}</span>
    </script>

    <script type="text/template" id="feedback-template">
        <div class="feedback">
            <h2 class="emphasis-color">{title}</h2>
            <p class="emphasis-color">{message}</p>
            <a href="{url}" class="emphasis-color">下一关 <i class="fa fa-caret-right blink" style="text-decoration: blink"></i></a>
        </div>
    </script>

    <script type="text/template" id="challenge-template">
        <div class="left">
            <h3>挑战 第{num}关: {challenge.condition.description}</h3>
        </div>
        <button class="right startstop unselectable" style="width: 110px">{startButtonText}</button>
        <h3 class="right">
            加速运行:
            <i class="fa fa-minus-square timescale_decrease unselectable"></i>
            <span class="emphasis-color" style="display: inline-block; width: 22px; text-align: center">{timeScale}</span>
            <i class="fa fa-plus-square timescale_increase unselectable"></i>
        </h3>
    </script>

    <script type="text/template" id="codestatus-template">
        <h5 class="error" style="display: {errorDisplay}"><i class="fa fa-warning error-color"></i> There is a problem with your code: {errorMessage}</h5>
    </script>

    <script type="text/plain" id="default-elev-implementation">
{
    init: function(elevators, floors) {
        var elevator = elevators[0]; // Let's use the first elevator

        // Whenever the elevator is idle (has no more queued destinations) ...
        elevator.on("idle", function() {
            // let's go to all the floors (or did we forget one?)
            elevator.goToFloor(0);
            elevator.goToFloor(1);
        });
    },
    update: function(dt, elevators, floors) {
        // We normally don't need to do anything here
    }
}
    </script>
    <script type="text/plain" id="devtest-elev-implementation">
{
    init: function(elevators, floors) {
        var selectElevatorForFloorPickup = function(floorNum) {
            return _.max(elevators, function(e) {
                return (_.contains(e.destinationQueue, floorNum) ? 4 : 0) +
                    (-e.destinationQueue.length*e.destinationQueue.length) +
                    (-e.loadFactor()*e.loadFactor() * 3);
            });
        };

        _.each(floors, function(floor) {
            floor.on("down_button_pressed up_button_pressed", function() {
                var elevator = selectElevatorForFloorPickup(floor.level);
                if(!_.contains(elevator.destinationQueue, floor.level)) {
                    elevator.goToFloor(floor.level);
                }
            });
        });
        _.each(elevators, function(elevator) {
            elevator.on("floor_button_pressed", function(floorNum) {
                elevator.goToFloor(floorNum);
            });
            elevator.on("idle", function() {
                elevator.goToFloor(0);
            });
        });
    },
    update: function(dt, elevators, floors) {
    }
}
    </script>


</head>
<body>
    
    <div class="container">
        
        <div class="header">
            <h1 class="left">电 梯 传 奇<em class="emphasis-color"> - 电梯调度编程游戏</em></h1>
            <a class="right" href="https://github.com/magwo/elevatorsaga/wiki/">讨论区</a>
            <a class="right" href="documentation.html#docs">编程文档</a>
            <a class="right" href="documentation.html">帮助</a>
        </div>

        <noscript>
            <h2>您的浏览器似乎不支持JavaScript。这个页面包含一个用JavaScript实现的基于浏览器的编程游戏。</h2>
        </noscript>

        <div class="challenge" style="height: 40px">
        </div>

        <div class="world">
            <div class="feedbackcontainer"></div>
            <div class="innerworld">
            </div>
            <div class="statscontainer">
                <div style="top: 20px"><span class="key">运送完成人数</span><span class="value transportedcounter"></span></div>
                <div style="top: 40px"><span class="key">电梯运行时间</span><span class="value elapsedtime"></span></div>
                <div style="top: 60px"><span class="key">每秒运送人数</span><span class="value transportedpersec"></span></div>
                <div style="top: 80px"><span class="key">平均待客时间</span><span class="value avgwaittime"></span></div>
                <div style="top: 100px"><span class="key">最大待客时间</span><span class="value maxwaittime"></span></div>
                <div style="top: 120px"><span class="key" title="Number of floors that have been travelled by elevators">电梯移动楼层</span><span class="value movecount"></span></div>
            </div>
        </div>

        <div class="codestatus"></div>
        <div class="code">
            <textarea name="Code" id="code"></textarea>
        </div>
        <button id="button_reset" style="float: left">重置代码</button>
        <button id="button_resetundo" style="float: left">还原代码</button>
        <button id="button_apply" style="float: right">应用</button>
        <button id="button_save" style="float: right">保存</button>
        <span id="save_message" style="float: right"></span>
        <span id="fitness_message" style="float: right"></span>
        <div style="clear:both;"></div>

        <div style="margin-top: 20px">
            <h3>感到困惑？访问 <a href="documentation.html">帮助（API）文档</a> 网页</h3>
        </div>
        <div class="footer">
            <h4>作者 Magnus Wolffelt and contributors</h4>
            <h4>版本 <span class="emphasis-color">1.6.5</span></h4>
            <h4>源码 <a href="https://github.com/magwo/elevatorsaga">GitHub</a></h4>
            <h4>程序 <a href="test/index.html">冒烟测试</a></h4>
            <h4><a href="/">返回首页</a></h4>
        </div>
    </div>

    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-56810935-1', 'auto');
        ga('send', 'pageview');
    </script>
    <a href="https://github.com/magwo/elevatorsaga" class="github-corner" aria-label="View source on GitHub">
        <svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#eee; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg>
    </a>
</body>
</html>
